package com.gotkicry.asynctask_listview;

import android.os.AsyncTask;
import android.util.Log;

/**
 * Created by Enzo Cotter on 2019/5/17.
 */

//测试用  与其他class无关
public class AsnycTest extends AsyncTask<String, Integer,String> {
    private static final String TAG = "AsnycTest";
    @Override
    protected String doInBackground(String... strings) {
        //strings[0] == 传入数据
        Log.d(TAG, "doInBackground: doInBackground");
        //publishProgress中的参数类型是AsyncTask的第二个参数类型，把参数传入到onProgressUpdate
        publishProgress(5);
        //return 数据类型为AsyncTask的第三个参数类型，把参数传入到onPostExecute
        return "测试1";
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        Log.d(TAG, "onProgressUpdate: onProgressUpdate");
        Log.d(TAG, "onProgressUpdate: "+values[0]);
    }

    @Override
    protected void onPostExecute(String s) {
        Log.d(TAG, "onPostExecute: onPostExecute");
        Log.d(TAG, "onPostExecute: "+s);
    }
}
